<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="../css/reset.css"/>
    <link rel="stylesheet" type="text/css" href="../css/chengshi.css">
<!--
    <style>
        @keyframes donghua{
            from{color: white;}
            to{color: red;}
        }
        .sec h4:hover{
            animation: donghua;
        }
    </style>
-->
</head>
<body>
    
    <header class="header">
        <div class="left">
            <img src="../imgs/fanhui.png"/>
            <p>首页</p>
        </div>
        <div class="center">城市</div>
        <div class="right"></div>
    </header>

    <section class="sec">
      
<!--
        <h4>全国中心</h4>
        <h4>河北省</h4>
        <h4>辽宁省</h4>
        <ul>
            <li>本溪市</li>
        </ul>
        <h4>福建省</h4>
        <h4>山东省</h4>
-->
        
    </section>
    
    <footer class="btn">
        点击加载更多省份
    </footer>
    
    
    <script src="../js/flexible.debug.js"></script>
    <script src="../js/flexible_css.debug.js"></script>
    <script src="../js/jquery-1.12.4.min.js"></script>
    <script src="../js/artTemplate.js"></script>
    
    
    <script type="text/html" id="list">
        
        {{each hh as v}}
            <div class="dd">
                <div class="left">
                    <h4>{{v.name}}</h4>
                </div>
                <div class="imgs">
                    <img src="../imgs/chengshi2.png"/>
                </div>
            </div>
        {{/each}}
        
    </script>
        
    <script>
        jQuery(function($){
            function lis(star, end){
                $.ajax({
                    type: "get",
                    dataType: "json",
                    url: "../json/chengshi.json",
                    success: function(data){
                        //console.log(data);
                        data = data.slice(star, end);
                        var str = template("list", {hh: data});
                        $(".sec").append($(str));
                    }
                }) 
            }
            
            var aa = 0, bb = 5;
            
            lis(aa, bb);
            
            $(".btn").on("click", function(){
                aa += 1;
                bb += 1;
                lis(aa, bb);
            });
        })
    </script>
    
    
</body>
</html>